<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('审批管理')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <p>关键字：</p>
                                <input type="text" name="keyword"/>
                            </li>
                            <li>
							项目类型：<select name="projectType" th:with="type=${@dict.getType('sys_normal_disable')}">
							            <option value="">全部</option>
										<option value="房建">房建</option>
										<option value="市政">市政</option>
								   </select>
							</li>
							<li class="select-time">
                                <p>审查日期：</p>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="beginProceduralCheakTime"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="endProceduralCheakTime"/>
                            </li>
                            <li class="select-time">
                                <p>上报日期：</p>
                                <input type="text" class="time-input" id="startTime1" placeholder="开始时间" name="beginReportDate"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime1" placeholder="结束时间" name="endReportDate"/>
                            </li>
                            <li>
							审查状态：<select name="role" th:with="type=${@dict.getType('sys_normal_disable')}">
							            <option value="">全部</option>
										<option value="上报">已上报</option>
										<option value="程序性审查退回">程序性审查退回</option>
										<option value="程序性审查通过">程序性审查通过</option>
										<option value="指定审查人员">指定审查人员</option>
										<option value="审查人员初审">审查人员初审</option>
										<option value="技术负责人审查退回">技术负责人审查退回</option>
										<option value="技术性整改上报">技术性整改上报</option>
										<option value="审查人员复审">审查人员复审</option>
										<option value="技术负责人审查通过">技术负责人审查通过</option>
								   </select>
							</li>  
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="col-sm-12 select-table table-striped">
                 <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:src="@{/js/plugins/datetime/moment.js}"></script>
    <script th:inline="javascript">
    var applyFlag = [[${@permission.hasPermi('supervise:constructionDrawingRecord:apply')}]];
    var drawFlag = [[${@permission.hasPermi('supervise:constructionDrawingRecord:draw')}]];
    var logFlag = [[${@permission.hasPermi('supervise:constructionDrawingRecord:log')}]];
    var certFlag = [[${@permission.hasPermi('supervise:constructionDrawingRecord:cert')}]];
    
    var prefix = ctx + "condrawing/condrawing";
    var enterPriseprefix = ctx + "enterprise/enterprise";
    var projectArchivesPrefix = ctx + "projectArchives/projectArchives";
    
    $(function() {
    	 var options = {
    			url: prefix + "/list",
                updateUrl: prefix + "/edit/{id}",
                exportUrl: prefix + "/export",
                detailUrl: prefix + "/detail/{id}",
                detailOneUrl: prefix + "/certificateTable/{id}",
                detailTwoUrl: prefix + "/drawing/{id}",
                detailThreeUrl: enterPriseprefix + "/detail/{id}",
                detailFourUrl: enterPriseprefix + "/bulidUnitDetail/{id}",
                detailFiveUrl: projectArchivesPrefix + "/detail/{id}",
                detailQuaUrl: prefix + "/detail/{id}",
                detailSixUrl: prefix + "/drawJournal/{id}",
                modalName: "施工图审查管理",
                columns: [{
                        field: 'id',
                        title: '序号',
						formatter: function (value, row, index) {
						
						    return index + 1;
						}
                    },
                    {
                        field: 'guid',
                        title: '施工图审标识符',
						visible: false
	                },
                    {
                        field: 'taskName',
                        title: '施工图审查工程名称'
	                }, 
					{
                        field: 'projectGuid',
                        title: '项目标识符',
						visible: false
                    },
                    {
                        field: 'projectName',
                        title: '所属项目',
                        formatter: function (value, row, index) {
                            var actions = [];
							if(row.projectGuid != null && row.projectGuid != ''){
								actions.push('<a href="javascript:void(0)" onclick="$.operate.detailTabRewriteFive(\'' + value + '\',\''+ row.projectGuid +'\')">'+value+'</a> ');
							}
                            return actions.join('');
                        }
                    },
                    {
                        field: 'relatedBuildUnitsList',
                        title: '相关建设单位(新数据)',
						visible: false
                    },
                    {
                        field: 'buildGuid',
                        title: '建设单位标示符',
						visible: false
                    },
                    {
                        field: 'buildName',
                        title: '建设单位',
						formatter: function (value, row, index) {
							var actions = [];
							var isExistence = 0;//是否存在，0否1是
							if(row.relatedBuildUnitsList != null && row.relatedBuildUnitsList.length!=0){
								for(i=0; i<row.relatedBuildUnitsList.length; i++){
									if(row.relatedDesignUnitsList[i].guid == row.designUnitGuid){
										isExistence = 1;
									}
									if(!$.common.isEmpty(row.relatedBuildUnitsList[i].guid)){
										actions.push('<a href="javascript:void(0)" onclick="$.operate.detailTabRewriteFour(\'' + row.relatedBuildUnitsList[i].name + '\',\''+ row.relatedBuildUnitsList[i].guid +'\')">'+row.relatedBuildUnitsList[i].name+'</a> </br> ');
									}else if($.common.isEmpty(row.relatedBuildUnitsList[i].guid)){
										actions.push('<a href="javascript:void(0)">'+row.relatedBuildUnitsList[i].name+'</a> </br> ');
									}
								}
							}
							if(!$.common.isEmpty(value) && isExistence == 0){
								if(!$.common.isEmpty(row.buildGuid)){
									actions.push('<a href="javascript:void(0)" onclick="$.operate.detailTabRewriteFour(\'' + value + '\',\''+ row.buildGuid +'\')">'+value+'</a> ');
								}else if($.common.isEmpty(row.buildGuid)){
									actions.push('<a href="javascript:void(0)">'+value+'</a> ');
								}
							}
							return actions.join('');
						}
                    },
					{
                        field: 'relatedDesignUnitsList',
                        title: '相关设计单位(新数据)',
						visible: false
	                },
                    {
                        field: 'designUnitGuid',
                        title: '设计单位标识符',
						visible: false
                    },
                    {
                        field: 'designUnitName',
                        title: '设计单位',
						formatter: function (value, row, index) {
							var actions = [];
							var isExistence = 0;//是否存在，0否1是
							if(row.relatedDesignUnitsList != null && row.relatedDesignUnitsList.length!=0){
								for(i=0; i<row.relatedDesignUnitsList.length; i++){
									if(row.relatedDesignUnitsList[i].guid == row.designUnitGuid){
										isExistence = 1;
									}
									if(!$.common.isEmpty(row.relatedDesignUnitsList[i].guid)){
										actions.push('<a href="javascript:void(0)" onclick="$.operate.detailTabRewriteThree(\'' + row.relatedDesignUnitsList[i].name + '\',\''+ row.relatedDesignUnitsList[i].guid +'\')">'+row.relatedDesignUnitsList[i].name+'</a> </br> ');
									}else if($.common.isEmpty(row.relatedDesignUnitsList[i].guid)){
										actions.push('<a href="javascript:void(0)">'+row.relatedDesignUnitsList[i].name+'</a> </br> ');
									}
								}
							}
							if(!$.common.isEmpty(value) && isExistence == 0){
								if(!$.common.isEmpty(row.designUnitGuid)){
									actions.push('<a href="javascript:void(0)" onclick="$.operate.detailTabRewriteThree(\'' + value + '\',\''+ row.designUnitGuid +'\')">'+value+'</a> ');
								}else if($.common.isEmpty(row.designUnitGuid)){
									actions.push('<a href="javascript:void(0)">'+value+'</a> ');
								}
							}
							return actions.join('');
						}
                    },
                    {
                        field: 'reviewUnitGuid',
                        title: '审查机构标识符',
						visible: false
	                },
                    {
                        field: 'reviewUnitName',
                        title: '审查机构',
						formatter: function (value, row, index) {
							var actions = [];
							actions.push('<a href="javascript:void(0)" onclick="$.operate.detailTabRewriteThree(\'' + value + '\',\''+ row.reviewUnitGuid +'\')">'+value+'</a> ');
							return actions.join('');
						}
	                },
                    {
                        field: 'role',
                        title: '当前状态'
	                },
                    {
                        field: 'modifyCount',
                        title: '整改次数',
						align: 'center'
	                },
                    {
                        field: 'reportDate',
                        title: '上报日期',
						formatter: function (value, row, index) {
							if(value == '' || value == null){
								return value;
							}else{
								return moment(value).format('YYYY-MM-DD');	
							}
						}
                    },
					{
	                    field: 'opera',
	                    title: '功能区',
                        formatter: function (value, row, index) {
                            var actions = [];
							var pattern=/[`~!@#$^&*()=|{}':;',\\\[\]\.<>\/?~！@#￥……&*（）——|{}【】'；：""'。，、？\s]/g;
							var newTask = row.taskName.replace(pattern,"");
                            actions.push('<a class="btn btn-success btn-xs ' + applyFlag + '" href="javascript:void(0)" onclick="$.operate.detailQYTabRewrite(\'' + row.guid + '\',\'' + newTask + '图审申请表\')"><i class="fa fa-edit"></i>申请表</a> ');
							actions.push('<a class="btn btn-success btn-xs ' + drawFlag + '" href="javascript:void(0)" onclick="$.operate.detailTwo(\'' + "施工图纸" + '\',\'' + row.guid + '\')"><i class="fa fa-edit"></i>图纸</a> ');
							actions.push('<a class="btn btn-success btn-xs ' + logFlag + '" href="javascript:void(0)" onclick="$.operate.detailTabRewriteSix(\'' + "日志" + '\',\'' + row.guid + '\')"><i class="fa fa-edit"></i>日志</a> ');
							actions.push('<a class="btn btn-success btn-xs ' + certFlag + '" href="javascript:void(0)" onclick="$.operate.detailTabRewriteOne(\'' + "图审合格书编辑日志" + '\',\'' + row.guid + '\')"><i class="fa fa-edit"></i>合格书</a> ');
                            return actions.join('');
	                       }
	                }]
        };
    	$.table.init(options);
    });
    </script>
</body>
</html>